#ifndef __MESH_H__
#define __MESH_H__
#include "vec2.h"
#include "vec3.h"
#include "vec4.h"
#include <vector>
#include <array>

struct Mesh {
    struct VertexIndex {
        using type = uint16_t;
        static constexpr int size = 3;

        union {
            struct {
                std::uint16_t vertexIndex;
                std::uint16_t texCoordIndex;
                std::uint16_t normalIndex;
            };
            std::uint16_t data[3];
        };

        std::uint16_t operator [] (size_t index) const {
            return data[index];
        }

        std::uint16_t& operator [] (size_t index) {
            return data[index];
        }
    };

    using TriangleIndex = std::array<VertexIndex, 3>;
    std::vector<Vec4f> vertices;
    std::vector<Vec3f> normal;
    std::vector<TexCoord> texCoords;
    std::vector<TriangleIndex> indices;
};

#endif